package com.zym.field_method08;

public class Student {
    //1.属性
    private String name;
    private int age;
    private String school;
    private String major;//专业

    //2.方法 省略get/set方法



    //3.构造器
    //①无参构造器
    public Student(){

    }

    //②有两个参数的构造器
    public Student(String nameParam,int ageParam){

        name = nameParam;
        age = ageParam;

    }

    //③有三个参数的构造器
    public Student(String nameParam,int ageParam,
                   String schoolParam){
        name = nameParam;
        age = ageParam;
        school = schoolParam;
    }
    //④有四个参数的构造器
    public Student(String nameParam,int ageParam,
                   String schoolParam,String majorParam){

        name = nameParam;
        age = ageParam;
        school = schoolParam;
        major = majorParam;
    }


    public String getInfo(){

        return "姓名:" + name + "\t年龄" + age
                +"\t学校:" + school + "\t专业:" + major;
    }

}
